SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.V_COMPRAS_DETALLES
AS
SELECT     dbo.COMPRAS_DETALLES.ID, dbo.COMPRAS_DETALLES.ID_PRODUCTO, dbo.PRODUCTOS.CODIGO, dbo.PRODUCTOS.ID_MEDIDA, dbo.MEDIDAS.MEDIDA, 
                      dbo.ORIGINALES.ID_DESCRIPCION, dbo.DESCRIPCIONES.DESCRIPCION, dbo.COMPRAS_DETALLES.CANTIDAD, dbo.COMPRAS_DETALLES.COSTO, 
                      dbo.COMPRAS_DETALLES.PRECIO, dbo.COMPRAS_DETALLES.DESCUENTO, dbo.COMPRAS_DETALLES.X_DESCUENTO, dbo.COMPRAS_DETALLES.IMPUESTO, 
                      dbo.COMPRAS_DETALLES.X_IMPUESTO, dbo.COMPRAS_DETALLES.C_DEVUELTA, dbo.COMPRAS_DETALLES.COSTO_ANTERIOR, 
                      dbo.COMPRAS_DETALLES.PRECIO_ANTERIOR
FROM         dbo.ORIGINALES INNER JOIN
                      dbo.PRODUCTOS ON dbo.ORIGINALES.ID = dbo.PRODUCTOS.ID_ORIGINAL INNER JOIN
                      dbo.DESCRIPCIONES ON dbo.ORIGINALES.ID_DESCRIPCION = dbo.DESCRIPCIONES.ID INNER JOIN
                      dbo.MEDIDAS ON dbo.PRODUCTOS.ID_MEDIDA = dbo.MEDIDAS.ID RIGHT OUTER JOIN
                      dbo.COMPRAS_DETALLES ON dbo.PRODUCTOS.ID = dbo.COMPRAS_DETALLES.ID_PRODUCTO
GO
EXEC sp_addextendedproperty N'MS_DiagramPane1', N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[37] 4[40] 2[12] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "ORIGINALES"
            Begin Extent = 
               Top = 160
               Left = 501
               Bottom = 279
               Right = 682
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "PRODUCTOS"
            Begin Extent = 
               Top = 43
               Left = 260
               Bottom = 162
               Right = 420
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "DESCRIPCIONES"
            Begin Extent = 
               Top = 165
               Left = 799
               Bottom = 269
               Right = 959
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "MEDIDAS"
            Begin Extent = 
               Top = 16
               Left = 505
               Bottom = 120
               Right = 665
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "COMPRAS_DETALLES"
            Begin Extent = 
               Top = 0
               Left = 25
               Bottom = 236
               Right = 187
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 3135
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 13', 'SCHEMA', N'dbo', 'VIEW', N'V_COMPRAS_DETALLES', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_DiagramPane2', N'50
         Or = 1350
      End
   End
End
', 'SCHEMA', N'dbo', 'VIEW', N'V_COMPRAS_DETALLES', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_DiagramPaneCount', 2, 'SCHEMA', N'dbo', 'VIEW', N'V_COMPRAS_DETALLES', NULL, NULL
GO
